DesignMasterID Property Example

This example sets the DesignMasterID property to the ReplicaID property setting of another database, making that database the Design Master in the replica set. The old and new Design Masters are synchronized to update the design change. For this code to work, you must create a Design Master and replica, include their names and paths as appropriate, and run this code from a database other than the old or new Design Master.

Sub SetNewDesignMaster(strOldDM as String, _
    strNewDM as String)

    Dim dbsOld As Database
    Dim dbsNew As Database

    ' Open the current Design Master in exclusive mode.
    Set dbsOld = OpenDatabase(strOldDM, True)

    ' Open the database that will become the new 
    ' Design Master.
    Set dbsNew = OpenDatabase(strNewDM)

    ' Make the new database the Design Master.
    dbsOld.DesignMasterID = dbsNew.ReplicaID

    ' Synchronize the old Design Master with the new
    ' Design Master, and allow two-way exchanges.
    dbsOld.Synchronize strNewDM, dbRepImpExpChanges
    dbsOld.Close
    dbsNew.Close

End Sub